/**
Date: 2025-08-13
Copyright (c) 2025 Industrial Software Feature Database
*/
import request from '@/utils/request';

/*******************************excel数据导入******************************************* */
// 获取要素库表结构
export function getMetadataTableInfo(param) {
  return request({
    url: '/isfd/metadataManagement/tableInfo',
    method: 'get',
    params: param
  });
}
// 确认导入
export function importExcelAboutData(param) {
  return request({
    url: '/isfd/metadataManagement/save',
    method: 'post',
    data: param,
    headers: { 'Content-Type': 'multipart/form-data' }
  });
}

// 数据质量报告
export function checkExcelQuality(param) {
  return request({
    url: '/isfd/metadataManagement/excelQuality',
    method: 'post',
    data: param
  });
}

// 业务场景定义
export function getBusinessSceneDefinitionList(params) {
  return request({
    url: '/isfd/metadataBusinessSceneDefinition/list',
    method: 'get',
    params
  });
}

// 要素库列表
export function getMetadataDatabaseList(params) {
  return request({
    url: '/isfd/metadataDatabase/list',
    method: 'get',
    params
  });
}

// 根据业务场景级联查询要素库列表
export function getMetadataDatabaseListByBusinessSceneCode(params) {
  return request({
    url: '/isfd/metadataDatabase/list/query',
    method: 'get',
    params
  });
}

// 获取场景列表
export function getBusinessList(param) {
  return request({
    url: '/isfd/metadataBusinessSceneDefinition/list',
    method: 'get',
    params: param
  });
}
//删除场景
export function deleteBusiness(id) {
  return request({
    url: `/isfd/metadataBusinessSceneDefinition/${id}`,
    method: 'delete'
  });
}
// 新增场景
export function addBusiness(data) {
  return request({
    url: `/isfd/metadataBusinessSceneDefinition`,
    method: 'post',
    data
  });
}
// 查询库类型列表
export function getDataBaseList(param) {
  return request({
    url: `/isfd/metadataDatabase/list`,
    method: 'get',
    params: param
  });
}
// 查询场景详情
export function getBusinessDetail(id) {
  return request({
    url: `/isfd/metadataBusinessSceneDefinition/${id}`,
    method: 'get'
  });
}
// 修改场景
export function updateBusiness(data) {
  return request({
    url: `/isfd/metadataBusinessSceneDefinition`,
    method: 'put',
    data
  });
}
/*******************************元数据分析******************************************* */
// 查询元数据详情
export function getBusinessAnalysisDetail(data) {
  return request({
    url: `/isfd/metadataManagementAnalysis/detail`,
    method: 'get',
    params: data
  });
}
export function getBloodRelationship(data) {
  return request({
    url: `/isfd/metadataManagementAnalysis/blood/relationship`,
    method: 'get',
    params: data
  });
}
// 查询数据库详情
export function getDataBaseDetail(id) {
  return request({
    url: `/isfd/metadataDatabase/${id}`,
    method: 'get'
  });
}
//查询数据详情
export function queryDataByTable(param) {
  if (!param.uri) {
    return;
  }
  return request({
    url: param.uri,
    method: param.methodTpye,
    data: { ...param }
  });
}

/*******************************要素库管理&元数据管理******************************************* */
// 新增/更新
export function addDatabase(param) {
  return request({
    url: '/isfd/databaseTypeManagement/save',
    method: 'post',
    data: param
  });
}
// 数据库列表
export function getDatabaseList(param) {
  return request({
    url: '/isfd/databaseTypeManagement/list',
    method: 'get',
    params: param
  });
}
// 删除数据库
export function deleteOperator(param) {
  return request({
    url: `/isfd/databaseTypeManagement/${param?.ids}`,
    method: 'delete'
  });
}
// 数据库详情列表
export function getmetadataTableList(param) {
  return request({
    url: '/isfd/metadataManagement/list',
    method: 'get',
    params: param
  });
}
//查询表结构
export function queryTableFileds(param) {
  return request({
    url: '/isfd/metadataManagement/tableInfo',
    method: 'get',
    params: param
  });
}
// 查询managementIds
export function queryManagementIds(param) {
  return request({
    url: '/isfd/metadataManagementAnalysis/queryManagementIds',
    method: 'get',
    params: param
  });
}

/*业务场景优化*/
// 新增业务场景
export function addBusinessScene(data) {
  return request({
    url: `/isfd/businessScenarios`,
    method: 'post',
    data
  });
}
// 修改业务场景
export function updateBusinessScene(data) {
  return request({
    url: `/isfd/businessScenarios`,
    method: 'put',
    data
  });
}
// 查询业务场景列表
export function getBusinessSceneList(param) {
  return request({
    url: `/isfd/businessScenarios/list`,
    method: 'get',
    params: param
  });
}
// 删除业务场景
export function deleteBusinessScene(ids) {
  return request({
    url: `/isfd/businessScenarios/${ids}`,
    method: 'delete'
  });
}
// 查询业务场景详情
export function getBusinessSceneDetail(id) {
  return request({
    url: `/isfd/businessScenarios/${id}`,
    method: 'get'
  });
}

// 业务场景地图新增
export function addBusinessSceneMap(data) {
  return request({
    url: `/isfd/sceneMap/add`,
    method: 'post',
    data
  });
}

// 业务场景地图修改
export function updateBusinessSceneMap(data) {
  return request({
    url: `/isfd/sceneMap`,
    method: 'put',
    data
  });
}

// 业务场景地图删除
export function deleteBusinessSceneMap(id) {
  return request({
    url: `/isfd/sceneMap/${id}`,
    method: 'delete'
  });
}

// 业务场景地图列表
export function getBusinessSceneMapList(param) {
  return request({
    url: `/isfd/sceneMap/list`,
    method: 'get',
    params: param
  });
}

// 业务场景地图详情
export function getBusinessSceneMapDetail(id) {
  return request({
    url: `/isfd/sceneMap/${id}`,
    method: 'get'
  });
}

// 模型列表查询
export function getModelList(param) {
  return request({
    url: `/isfd/databaseModelingConfig/list`,
    method: 'post',
    data: param
  });
}

// 模型列表查询
export function getModelDatabaseList(data) {
  return request({
    url: `/isfd/databaseModelingConfig/list`,
    method: 'post',
    data
  });
}
/*******************************建模管理******************************************* */
